﻿<!DOCTYPE html>
<!--承包商人员名录管理编辑-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

    <style>
        .el-dialog__body {
            height: 100% !important;
        }

        .el-dialog.is-fullscreen {
            overflow: hidden !important;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak class="popupW100">
        <el-form :model="Form" status-icon :rules="rules" ref="ruleForm" label-width="100px" size="mini"
            label-position="right">

            <el-row>
                <el-col :span="11">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input type="text" v-model="Form.PersonnelName" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{BlackContractorPersonnelDirectoryManagement.PersonnelName+mark.m}}
                                </template>
                            </el-input>
                            <span class="iputLineMust" v-if="Form.PersonnelName.length<=0">
                                <!-- 必填项添加 -->
                                <img src="/static/images/exclamation.png" alt="">
                            </span>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="8" :offset="2">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input type="text" v-model="Form.ContractorName" autocomplete="off" size="mini"
                                :disabled="true">
                                <template slot="prepend">
                                    {{BlackContractorPersonnelDirectoryManagement.ContractorName+mark.m}}
                                </template>
                            </el-input>
                            <span class="iputLineMust" v-if="Form.YearMonth.ContractorName<=0">
                                <!-- 必填项添加 -->
                                <img src="/static/images/exclamation.png" alt="">
                            </span>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="1" :offset="1">
                    <el-button type="primary" @click="ContractorInput('tj')">{{col.Choose}}</el-button>
                </el-col>
                <el-col :span="11">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <div class="elst-select-mini">
                                <el-input size="mini">
                                    <template slot="prepend">
                                        {{BlackContractorPersonnelDirectoryManagement.YearMonth+mark.m}}
                                    </template>
                                    <el-date-picker slot="suffix" v-model="Form.YearMonth" type="month" size="mini"
                                        format="yyyy-MM" value-format="yyyy-MM" placeholder="选择时间">
                                    </el-date-picker>
                                </el-input>
                            </div>
                            <span class="iputLineMust" v-if="Form.YearMonth.length<=0">
                                <!-- 必填项添加 -->
                                <img src="/static/images/exclamation.png" alt="">
                            </span>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="11" :offset="2">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input type="text" v-model="Form.phone" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{BlackContractorPersonnelDirectoryManagement.phone+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="11">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    <div> {{BlackContractorPersonnelDirectoryManagement.sex+mark.m}}</div>
                                </template>
                                <el-select @visible-change="visibleChange" v-model="Form.sex" slot="suffix"
                                    :placeholder="BlackContractorPersonnelDirectoryManagement.sex">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option v-for="item in sex" :label="item.value" :value="item.key">
                                    </el-option>
                                </el-select>
                            </el-input>
                            <span class="iputLineMust" v-if="Form.sex.length<=0">
                                <!-- 必填项添加 -->
                                <img src="/static/images/exclamation.png" alt="">
                            </span>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="11" :offset="2">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input type="text" v-model="Form.IDNumber" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{BlackContractorPersonnelDirectoryManagement.IDNumber+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="11">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    <div> {{BlackContractorPersonnelDirectoryManagement.ConstructionCategory+mark.m}}
                                    </div>
                                </template>
                                <el-select @visible-change="visibleChange" v-model="Form.ConstructionCategory" slot="suffix"
                                    :placeholder="BlackContractorPersonnelDirectoryManagement.ConstructionCategory">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option v-for="item in ConstructionCategory" :label="item.value"
                                        :value="item.key">
                                    </el-option>
                                </el-select>
                            </el-input>
                            <span class="iputLineMust" v-if="Form.ConstructionCategory.length<=0">
                                <!-- 必填项添加 -->
                                <img src="/static/images/exclamation.png" alt="">
                            </span>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="24">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <div class="el-input--mini el-input-group">
                                <div class="el-input-group__prepend">
                                    {{BlackContractorPersonnelDirectoryManagement.MainaAchievement+mark.m}}
                                </div>
                                <el-input class="el-textarea__inner" type="textarea" v-model="Form.MainaAchievement"
                                    autocomplete="off"></el-input>
                            </div>
                        </el-form-item>
                    </div>
                </el-col>

            </el-row>
            <el-row>
                <el-col class="head-tool">
                    <el-button type="primary" @click="UserInput('tj')">添加上岗证照</el-button>
                </el-col>
            </el-row>
            <el-row>
                <el-col span="24">
                    <el-table stripe :data="Form.EmploymentLicenseList" style="width: 100%">

                        <el-table-column prop="LicenseName" show-overflow-tooltip="true"
                            :label="BlackContractorPersonnelDirectoryManagement.LicenseName">
                            <template slot-scope="scope">
                                <el-button type="text" @click="label_click('xz',scope.row.id)">
                                    {{scope.row.LicenseName}}
                                </el-button>
                            </template>
                        </el-table-column>

                        <el-table-column prop="BeginTime" :label="BlackContractorPersonnelDirectoryManagement.BeginTime"
                            show-overflow-tooltip="true">
                        </el-table-column>
                        <el-table-column prop="EndTime" :label="BlackContractorPersonnelDirectoryManagement.EndTime"
                            show-overflow-tooltip="true">
                        </el-table-column>
                        <el-table-column prop="EditorTime"
                            :label="BlackContractorPersonnelDirectoryManagement.EditorTime"
                            show-overflow-tooltip="true">
                        </el-table-column>
                        <el-table-column label="操作">
                            <template slot-scope="scope">
                                <el-button @click.native.prevent="deleteRow(scope.$index, Form.EmploymentLicenseList)"
                                    type="text" size="small">
                                    移除
                                </el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-col>
            </el-row>


            <el-row type="flex" justify="end" style="margin-top:10px">
                <el-form-item>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSave}}</el-button>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnCommit}}</el-button>
                    <el-button type="primary" @click="onBack">{{col.btnBack}}</el-button>
                </el-form-item>
            </el-row>
        </el-form>
        <el-dialog :title="Title" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%" height="80%"
            top="10vh" fullscreen="true">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>
    <script type="text/javascript">

        var app = new Vue({
            el: '#app',
            data: {
                id: '',
                Title: '',
                //业务表单内容
                Form: {
                    id: guidEmpty,
                    PersonnelName: '',
                    sex: '',
                    YearMonth: '',
                    phone: '',
                    ContractorName: '',
                    IDNumber: '',
                    ConstructionCategory: '',
                    MainaAchievement: '',
                    Age: '',
                    EmploymentLicenseList: [],
                },
                ConstructionCategory: [],
                CheckProjectList: [],
                ListItem: ListItem,
                sex: [],
                //表单验证
                rules: {
                    PersonnelName: [
                        verification.NotNull,
                        { pattern: verification.StringLengthAtoB.t.format(2, 5), message: verification.StringLengthAtoB.m.format(2, 5), trigger: 'blur' }
                    ],
                    ContractorName: [
                        verification.NotNull,
                        { pattern: verification.StringLengthAtoB.t.format(5, 50), message: verification.StringLengthAtoB.m.format(5, 10), trigger: 'blur' }
                    ],
                    ConstructionCategory: [
                        verification.NotNull
                    ],
                    sex: [
                        verification.NotNull
                    ]
                }
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                //点击表格中数据发生方法
                label_click: function (val, id) { DialogShow(this, val, "BlackContractorPersonnelDirectoryManagementManagementInputMineImg.html", id); },
                UserInput: function (val, id) {
                    this.Title = "上岗证照管理"
                    DialogShow(this, val, "ContractoEmploymentLicenseAdd.html", id);
                },
                //提交数据
                onSubmitForm: function (formName) {
                    var mythis = this;
                    this.$refs[formName].validate(function (valid) {
                        //验证通过
                        if (valid) {
                            onSubmitForm(this, '/api/BlackContractorPersonnelDirectoryManagement/Save', mythis.Form);
                        } else {
                            //验证失败
                            return false;
                        }
                    });
                },
                getData: function () {
                    getData(this, '/api/BlackContractorPersonnelDirectoryManagement/get?id=' + this.id);
                },
                ContractorInput: function (val, id) {
                    this.Title = "承包商列表"
                    DialogShow(this, val, "ContractorDirectoryList.html", id);
                },
                onBack: function () {
                    parent.app.ListItem.dialogVisible = false;
                },
                deleteRow: function (index, rows) {
                    rows.splice(index, 1);
                },
            },
            mounted: function () {
                this.ConstructionCategory = getDicData('25');
                this.sex = getDicData('01');
                this.id = getUrlParam("id");
                this.getData();
            }
        });
    </script>
</body>

</html>